<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    /*
    null转化为数字结果为0 
    undefined转化为数字结果是NaN
    可以使用parseInt，praseFolat，Number来实现
    将字符串的
    */
    var b1 = true;
    var b2 = false; 
    var result1 = b1 + 0;
    var result2 = b2 + 0;
    console.log(result1,result2);
    var n1=null;
    var result4=Number(null);
    console.log(result4);
    var n2=undefined;
    var result3=Number(undefined);
    console.log(result3);

    var str1="123";
    var str2="abc123";

    var result5=parseInt(str1);
    console.log(result5);
    var result6=parseInt(str2);
    console.log(result6);
</script>
</html>